import { service as request } from '@/utils/request'

export function getList (data) {
    return request({
        url: `/hawk/system/role/search/${data.page.current}/${data.page.size}/?name=${data.query.name}`,
        method: "get"
    })
}

export function getById (id) {
    return request({
        url: `/hawk/system/role/get/${id}`,
        method: "get"
    })
}

export function exists (data) {
    return request({
        url: `/hawk/system/role/exists?name=${data}`,
        method: "get",
        // params: {
        //     data
        // }       
    })
}

export function doAdd (data) {
    return request({
        url: '/hawk/system/role/save',
        method: 'post',
        data
    })
}
export function doEdit (data) {
    return request({
        url: '/hawk/system/role/update',
        method: 'put',
        data
    })
}
export function doDelete (idArray) {
    return request({
        url: `/hawk/system/role/del`,
        method: 'delete',
        data: idArray
    })
}
export function getOne (id) {
    return request({
        url: `/system/role/${id}`,
        method: 'get'
    })
}

export function assignPermission (data) {
    return request({
        url: `/hawk/system/role/assignment`,
        method: 'post',
        data: data
    })
}

export function getAllRoles () {
    return request({
        url: `/hawk/system/role/get/all`,
        method: 'get',
    })
}